﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Chinaer.DTO
{
    [Serializable]
    [DataContract]
    public class Base_ID
    {

        private Chinaer.Core.BaseCore.LoginStatus _loginStatusEnum = Chinaer.Core.BaseCore.LoginStatus.False;
        /// <summary>
        /// 登录状态
        /// </summary>
        [DataMember]
        public Chinaer.Core.BaseCore.LoginStatus LoginStatus
        {
            get
            {
                return _loginStatusEnum;
            }
            set
            {
                _loginStatusEnum = value;
            }
        }

        private bool _isUse = true;
        private DateTime _createTime = DateTime.Now;
        private bool _isDelete = false;
        private DateTime _modifyTime = DateTime.Now;
        private string _id = string.Empty;

        public byte[] RowVersion { get; set; }

        [DataMember]
        public string ID
        {
            get {

                if (string.IsNullOrEmpty(_id))
                {
                    _id = Chinaer.Core.Helper.GenerateIDHelper.GenerateID();
                }
                return _id;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    _id = Chinaer.Core.Helper.GenerateIDHelper.GenerateID();
                }
                else
                {
                    _id = value;
                }
            }
        }        
        public bool IsUse
        {
            get
            {
                return _isUse;
            }
            set
            {
                _isUse = value;
            }
        }        
        public DateTime CreateTime
        {
            get
            {
                if (_createTime == DateTime.MinValue)
                {
                    _createTime = DateTime.Now;
                }
                return _createTime;

            }
            set
            {
                _createTime = value;
            }
        }

        public string ModifyUserID { get; set; }
  
        public DateTime ModifyTime
        {
            get {
                if (_modifyTime == DateTime.MinValue)
                {
                    _modifyTime = DateTime.Now;
                }
                return _modifyTime; }
            set
            {
                _modifyTime = value;
            }
        }

        public bool IsDelete
        {
            get
            {
                return _isDelete;
            }
            set
            {
                _isDelete = value;
            }
        }
    }
}
